-
Notifications
You must be signed in to change notification settings - Fork 320
Migrate AttachmentViewHolderFactory to compose #2900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
4b9b344 to
2d30047
Compare
2d30047 to
cb041be
Compare
cb041be to
49fdf6c
Compare
| displaySnackbar(view, R.string.upload_failed) | ||
| file.delete() | ||
| return@setFragmentResultListener | ||
| val displayTakePhoto = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| val displayTakePhoto = | |
| val displayTakePhotoButton = |
| coroutineScope.launch { | ||
| val attachmentMimeTypeWithSubType = context.getMimeTypeFromUri(uri) | ||
| val attachmentByteArray = context.readBytesFromUri(uri) | ||
| currentAttachment = | ||
| Attachment().apply { | ||
| contentType = attachmentMimeTypeWithSubType | ||
| data = attachmentByteArray | ||
| title = fileName | ||
| creation = Date() | ||
| } | ||
|
|
||
| val answer = | ||
| QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply { | ||
| value = currentAttachment | ||
| } | ||
| questionnaireViewItem.setAnswer(answer) | ||
|
|
||
| displayUploadedText = true | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can have this as a separate function?
looks very similar to line 200
| coroutineScope.launch { | ||
| val attachmentMimeTypeWithSubType = context.getMimeTypeFromUri(it) | ||
| val attachmentByteArray = context.readBytesFromUri(it) | ||
| currentAttachment = | ||
| Attachment().apply { | ||
| contentType = attachmentMimeTypeWithSubType | ||
| data = attachmentByteArray | ||
| title = getFileName(context.contentResolver, it) | ||
| creation = Date() | ||
| } | ||
|
|
||
| val answer = | ||
| QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply { | ||
| value = currentAttachment | ||
| } | ||
| questionnaireViewItem.setAnswer(answer) | ||
|
|
||
| displayUploadedText = true | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2863
Description
Clear and concise code change description.
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
Screenshots (if applicable)
Checklist
./gradlew spotlessApplyand./gradlew spotlessCheckto check my code follows the style guide of this project../gradlew checkand./gradlew connectedCheckto test my changes locally.